package com.shkg.opencloud.fastdfs.config;

import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 文件系统
 */
@Data
@Component
@ConfigurationProperties(prefix = "file-system")
public class FileSystemConfig {

    private static final String SLANT = "/";

    private String protocol;

    private String domain;


    public String getFileFullPath(String picUrl) {
        if (StringUtils.isNotEmpty(picUrl)) {
            if (picUrl.startsWith(SLANT)) {
                return this.getProtocol() + this.getDomain() + picUrl;
            }
            return this.getProtocol() + this.getDomain() + SLANT + picUrl;
        } else {
            return "";
        }
    }

}
